//
//  LoginTest.m
//  单元测试Tests
//
//  Created by 崔博 on 2018/8/7.
//  Copyright © 2018年 崔博. All rights reserved.
//

#import <XCTest/XCTest.h>
#import "ViewController.h"
@interface LoginTest : XCTestCase

@property (nonatomic, strong) ViewController * vc;

@property (nonatomic,strong) XCTestExpectation *e;

@end

@implementation LoginTest

- (void)setUp {
    self.vc = [[ViewController alloc] init];
    // 1 声明XCTestExpectation对象
    XCTestExpectation *e = [self expectationWithDescription:@"des"];
    // 2 对该对象强引用
    self.e = e;
    [super setUp];
    
}

- (void)tearDown {
    
    [super tearDown];
}

- (void)testExample {
    
    int num = [self.vc getNum:10];
    [self.vc getPersonInfo:^{
        
        [self.e fulfill];
    }];
    //如果超时，则认为发送失败
    [self waitForExpectationsWithTimeout:3 handler:^(NSError *error) {
        if(error)
        {
            XCTFail(@"Expectation Failed with error: %@", error);
        }
    }];
    
    XCTAssertEqual(num, 10,@"测试错误");
}



@end
